﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using System.Data.SqlClient;
 
using System.IO;
using community.LanFen;


namespace community
{
    public partial class residentcheck : Form
    {
        string ck;//comname显示的值
        public static string resident_JMBH;//居民编号
        string strSql;
        int hyXLH;//高血压序列号
        SqlConnection conn;
        sql_database sd = new sql_database();

        public residentcheck()
        {
            InitializeComponent();
        }

        private void button1_Click(object sender, EventArgs e)
        {

           

            ck = Convert.ToString(queryfactor.Text);
            string str1 = " residentname_chr='";
            if (radname.Checked) str1 = " residentname_chr='";
            if (radid.Checked) str1 = " identitycard_chr='";
            if (radcode.Checked) str1 = " inhabitantcode_chr='";
            if (radcom.Checked) str1 = "communityname_chr='";
             
                strSql = "select inhabitantcode_chr as 居民编号,residentname_chr as 居民姓名,communityname_chr as 所属社区,communitycode_chr as 社区编号,familyname_chr as 所属家庭,familycode_chr as 家庭编号,";
                strSql += "patientcardid_chr as 诊疗卡号,sex_chr as 性别,birth_dat as 出生日期,rehouseholder_vchr as 与户主关系,country_chr as  国籍, nation_chr as 民族,province_chr as 籍贯,identitycard_chr as 身份证号,";
                strSql += "residentcard_vchr as 居住证号,phone_chr as 本人电话,homephone_vchr as 家庭电话,contactpeople_chr as 联系人姓名,contactstyle_chr as 联系人电话,fathername_vchr as 父亲姓名,fathercode_vchr as 父亲编号,mothername_vchr as 母亲姓名,";
                strSql += "mothercode_vchr as 母亲编号,marriagestate_chr as 婚姻状况,careerstyle_chr as 职业,culture_vchr as 文化程度,residenttype_vchr as 常住类型,company_chr as 工作单位,registaddress_vchr as 户口地址,";
                strSql += "addressprovince_vchr as 家庭地址_省,addresscity_vchr as 家庭地址_市,addresscounty_vchr as 家庭地址_县,addressvillage_vchr as 家庭地址_乡,addresshamlet_vchr as 家庭地址_村,addressdoorplate_vchr as 家庭地址_号,";
                strSql += "postnum_chr as 邮政编码,paytype_vchr as 医费支付方式,e_mail as 电子邮箱,qq as 血型,msn as RH阴性,createdoctor_chr as 建档医生,createdoctorid_chr as 建档医生ID, createunit_vchr as 建档单位,createdate_dat as 建档时间,recorder_chr as 录入者,recorderid_chr as 录入者ID,image_chr as 图片 ";
                strSql += "   from t_cs_inhabitantrecord_new  where " + str1 + ck + "'";
                sd.show_dataGridview(strSql, "t_cs_inhabitantrecord_new ", findresident);
                 
             
        } 

        private void dataGridView1_CellContentClick(object sender, DataGridViewCellEventArgs e)
        {

        }

        private void findresident_CellClick(object sender, DataGridViewCellEventArgs e)
        {
            if (e.RowIndex >= 0)
            {
                
                residentcode.rescode = findresident.Rows[e.RowIndex].Cells[0].Value.ToString();

                this.DialogResult = DialogResult.OK;
            }
        }

        private void residentcheck_Load(object sender, EventArgs e)
        {
            radname.Checked = true;

                strSql = "select inhabitantcode_chr as 居民编号,residentname_chr as 居民姓名,communityname_chr as 所属社区,communitycode_chr as 社区编号,familyname_chr as 所属家庭,familycode_chr as 家庭编号,";
                strSql += "patientcardid_chr as 诊疗卡号,sex_chr as 性别,birth_dat as 出生日期,rehouseholder_vchr as 与户主关系,country_chr as  国籍, nation_chr as 民族,province_chr as 籍贯,identitycard_chr as 身份证号,";
                strSql += "residentcard_vchr as 居住证号,phone_chr as 本人电话,homephone_vchr as 家庭电话,contactpeople_chr as 联系人姓名,contactstyle_chr as 联系人电话,fathername_vchr as 父亲姓名,fathercode_vchr as 父亲编号,mothername_vchr as 母亲姓名,";
                strSql += "mothercode_vchr as 母亲编号,marriagestate_chr as 婚姻状况,careerstyle_chr as 职业,culture_vchr as 文化程度,residenttype_vchr as 常住类型,company_chr as 工作单位,registaddress_vchr as 户口地址,";
                strSql += "addressprovince_vchr as 家庭地址_省,addresscity_vchr as 家庭地址_市,addresscounty_vchr as 家庭地址_县,addressvillage_vchr as 家庭地址_乡,addresshamlet_vchr as 家庭地址_村,addressdoorplate_vchr as 家庭地址_号,";
                strSql += "postnum_chr as 邮政编码,paytype_vchr as 医费支付方式,e_mail as 电子邮箱,qq as 血型,msn as RH阴性,createdoctor_chr as 建档医生,createdoctorid_chr as 建档医生ID, createunit_vchr as 建档单位,createdate_dat as 建档时间,recorder_chr as 录入者,recorderid_chr as 录入者ID,image_chr as 图片 ";
                strSql += "   from t_cs_inhabitantrecord_new ";
                sd.show_dataGridview(strSql, "t_cs_inhabitantrecord_new ", findresident);
        }
    }
}

